<h2>Variations</h2>
<%=error_message_on :product, :variations %>
<table class="basic-table">
	<thead>
		<tr>
			<th>Options</th>
			<th>Action</th>
		</tr>
	</thead>
	<tbody>
		<% @product.variations.each do |v| %>
			<tr>
				<td><%= variation_options v %></td>
				<td>
				  <%= link_to_remote "Remove",
				                     :url => {:action => 'delete_variation', :id=> @product, :variation_id => v},
				                     :before => "Element.show('busy_indicator')", 
				                     :complete => "Element.hide('busy_indicator')",
				                     :update => 'variation-listing' %>
				</td>
			</tr>
		<% end %>
		<% if @product.variations.empty? %>
			<tr>
				<td colspan="3">None Available.</td>
			</tr>
		<% end %>
	</tbody>
</table>
<% unless @product.new_record? or @product.selected_options.empty? %>
  <span id="new-var-link">
	  <%= link_to_remote "New Product Variation",
	                     :url => {:controller => 'products', :action => 'new_variation', :id=> @product},
	                     :before => "Element.hide('new-var-link');Element.show('var_busy_indicator')", 
	                     :complete => "Element.hide('var_busy_indicator')",
	                     :update => 'new-variation' %>
  </span>
	<%= image_tag "spinner.gif", :plugin=>"railscart", :style => "display:none", :id => 'var_busy_indicator' %>
<% end %>

<div id="new-variation"></div>
